package com.six.usersso.controller;

import com.six.core.util.JwtUtil;
import com.six.core.util.WebUtil;
import com.six.core.vo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author: WangPeng
 * @createTime: 2023/03/06 9:59
 * @description:
 * @version: v1.0
 */
@RestController
@RequestMapping("/user/sso")
public class UserSsoController {

    @PostMapping("/getUserType")
    public Result getUserType(){
        HttpServletRequest request = WebUtil.getRequest();
        String token = request.getHeader("token");
        Map<String, Object> map = JwtUtil.decodeJWT(token);
        Integer is_type = (Integer) map.get("is_type");
        return new Result(200,"获取成功",is_type);
    }

}